package com.guns.server;

import com.guns.domain.Car;
import com.guns.domain.CarInfo;
import com.guns.repository.InfoRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.stereotype.Service;


import java.util.List;

@Service
public class CarServer {
    @Autowired
    private InfoRepository infoRepository;
    public CarInfo selectByNumber(String  number){
        CarInfo carInfo=new CarInfo();
        carInfo.setPlateNumber(number);
        ExampleMatcher matcher = ExampleMatcher.matching()
                .withIgnorePaths("status");
        Example<CarInfo> edx=Example.of(carInfo,matcher);
        return  infoRepository.findOne(edx);
    }

    public void updateStatusByNum( int status,  String number){
      infoRepository.updateByNum(status,number);
    }
}
